import React, { PureComponent } from 'react'
import Topic from './commen/Topic'
import List from './commen/List'
import Recommend from './commen/Recommend'
import Article from './commen/Article'
import { connect } from 'react-redux'
import  { actionCreators }  from './store'
import {
    HomeWrapper,
    HomeLeft,
    HomeRight
} from './style.js'
class Home extends PureComponent {
    render () {
        return (
            <div>
                <HomeWrapper>
                    <HomeLeft>
                        <img className="bannerImg" src="http://upload.jianshu.io/admin_banners/web_images/4520/83fadd2df821d52fb277287ac4a189e8d21b7b65.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/1250/h/540" alt="" />
                        <Topic />
                        <List />
                    </HomeLeft>
                    <HomeRight>
                        <Recommend />
                        <Article />
                    </HomeRight>
                </HomeWrapper>
            </div>
        )
    }

    componentDidMount () {
        this.props.getHomeList()
    }
}

const mapDispatchToProps = (dispatch) => ({
    getHomeList () {
        dispatch(actionCreators.getHomeData())
    }
})



export default connect(null, null)(Home)